<?php

include_once("codelibrary/inc/variables.php");


include_once("session.php");

include_once("codelibrary/inc/functions.php");
include_once("codelibrary/calendar/showcal.php");

// include('includes/header.php');

$business_id = $_SESSION['business_id'];

$today_date = date("Y-m-d");
$date_passed = $today_date;
$displayed_day = date("d");
$displayed_month = date("n");
$displayed_year = date("Y");
$staff_id = $_GET['staff_id'];
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="LTR" lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Online Appointment</title>

<base >
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<title>Staff Management</title>

</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">


<table cellpadding="0" cellspacing="0" border="0">
  <tr>
    <td style="background:url(images/top.gif) repeat-x top; "><table cellpadding="0" cellspacing="0" border="0" style="width:764px" align="center">
        <tr>
          <td><table cellpadding="0" cellspacing="0" border="0" style="height:57">
              <tr>
                <td height="57"><table cellpadding="0" cellspacing="0" border="0" style="height:1 ">
                    <tr>
                      <td style="width:468px" height="1"></td>
                      <td height="1"></td>
                    </tr>
                  </table>
                  <table cellpadding="0" cellspacing="0" border="0" style="height:3 ">
                    <tr>
                      <td height="3" valign="top" bgcolor="#2A2A2A"><a href="make-appointment.php"><img src="images/appointment1.gif" width="123" height="25" border="0" align="absmiddle"></a><span><a href="customer-view-details.php" class="toptxt-mOver">&nbsp;Customers&nbsp;</a></span> <img src="images/seprator1.gif" width="11" height="25" align="absmiddle">&nbsp;&nbsp;<a href="staff_members.php" class="toptxt-mOver">Staff Members&nbsp;</a><span class="leftmenutxt">&nbsp;<img src="images/seprator1.gif" width="11" height="25" align="absmiddle"></span> &nbsp;<span>&nbsp;<a href="service-view-details.php" class="toptxt-mOver" >Services&nbsp;</a>&nbsp;<img src="images/seprator1.gif" width="11" height="25" align="absmiddle">&nbsp;&nbsp;&nbsp;<a href="reports-view-details.php" class="toptxt-mOver">Reports&nbsp;</a>&nbsp;<img src="images/seprator1.gif" width="11" height="25" align="absmiddle">&nbsp;&nbsp;&nbsp;<a href="update-company-location.php" class="toptxt-mOver">Company&nbsp;</a>&nbsp;<img src="images/seprator1.gif" width="11" height="25" align="absmiddle">&nbsp;&nbsp;&nbsp;<a href="location-view-details.php" class="toptxt-mOver">Lists&nbsp;</a>&nbsp;<img src="images/seprator1.gif" width="11" height="25" align="absmiddle">&nbsp;&nbsp;&nbsp;<a href="help.php" class="toptxt-mOver">Help&nbsp;</a> <img src="images/seprator1.gif" width="11" height="25" align="absmiddle">&nbsp; &nbsp;<a href="logout.php" class="toptxt-mOver">Logout</a></span><br></td>
                    </tr>
                  </table></td>
              </tr>
            </table>
            
            
          </td>
        </tr>
        <tr>
          <td>
            
            
            <table border="0" width="105%" cellspacing="0" cellpadding="0">
              <tr>
                <td valign="top" class="col_left">
                  <table border="0"cellspacing="0" cellpadding="0" class="box_width_left">
                    <tr>
                      <td width="100%"><table border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td><table border="0" width="100%" cellspacing="0" cellpadding="0" class="">
                                <tr>
                                  <td><table border="0" width="100%" cellspacing="0" cellpadding="0"  class="" height="91">
                                      <tr>
                                        <td align="center" height="91"><img border="0" src="images/logo.jpg" width="208" height="86"></td>
                                      </tr>
                                    </table></td>
                                </tr>
                              </table></td>
                          </tr>
                          <tr>
                            <td><table border="0" width="100%" cellspacing="0" cellpadding="0"  class="box_header_txt" height="48">
                                <tr>
                                  <td style="background-image: url(images/1_bg2-2.gif)" height="1"><p style="margin-top: 16"> </td>
                                </tr>
                              </table>
                              <table border="0" width="100%" cellspacing="0" cellpadding="0"   style="border-bottom:12px solid #ffffff;">
                                <tr>
                                  <td><table border="0" width="100%" cellspacing="0" cellpadding="0"  style="margin-bottom:0px;background:#7C7C7C url(images/1_line.gif) no-repeat left bottom;" >
                                      <tr>
                                        <td  style="padding:3px 16px 8px 25px;">
                                          <table width="100%" border="0">

                                            <tr>
                                              <td><?php
								    showStaffSelect($staff_id)
								 ?>&nbsp;<br>&nbsp;
                                              </td>
                                            </tr>
											
                                            <tr>
                                              <td><?php
              showCalendar($staff_id,"make-appointment.php");
          ?>
		  <script>
		  document.getElementById('selectstaff').value='<?= $staff_id ?>';
		  </script>

                                              </td>
                                            </tr>
                                          </table>
                                          </td>
                                      </tr>
                                    </table></td>
                                </tr>
                              </table></td>
                          </tr>
                          
                          <tr>
                            <td class="">&nbsp;</td>
                          </tr>
                          
                        </table></td>
                      <td><img src="images/spacer.gif" border="0" alt="" width="15" height="1"></td>
                    </tr>
                  </table>
                  
                </td>
                
                <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"  class="cont_header_txt">
                    <tr>
                      <td><table border="0" cellpadding="0" cellspacing="0" bgcolor="#EAEAEA" class="cont_header_txt">
                          <tr>
                            <td><img src="images/1_q1.gif" border="0" alt="" width="45" height="39"></td>
                            <td style="width:100%">Make Appointments </td>
                            <td><img src="images/1_q2.gif" border="0" alt="" width="10" height="39"></td>
                          </tr>
                        </table></td>
                    </tr>
                  </table>
                  
                  <table cellpadding="0" cellspacing="0" border="0" style="border:0px solid #DEDEDE; border-width:0px 1px 0px 1px;">
                    <tr>
                      <td style="background:#ffffff;border:0px solid #ffffff; border-width:18px 5px 10px 5px;"><!-- new_products //-->
                        <table border="0"  cellpadding="2" cellspacing="1" class="box_width_cont product">
                          <tr>
                            <td><form name="datefrm" action="make-appointment.php?staff_id=<?=$staff_id;?>&amp;type=<?=$type;?>" method="post">
                                <br/>
                                <br/>
                                <input type="submit" name="prev" value="<<" class="button">
                                <input type="submit" name="next" value=">>" class="button">
                                <?php
datelisting($date_passed);
?>
                                &nbsp;&nbsp;
                                <input type="submit" name="Go" value="Go" class="button" />
                                <br />
                                <br />
                            </form></td>
                          </tr>
                          <tr>
                            <td>&nbsp;</td>
                          </tr>
                          <?php
								  if(isset($_REQUEST['msg']) && ($_REQUEST['msg']=="Added" || $_REQUEST['msg']=="Updated"))
								  {
								    $getapptdata = getAnyTableWhereData(	
									$finalize_appointment_table," and appt_id='".$_REQUEST[
									'appt_id']."'");
									$customer_id = $getapptdata['customer_id'];
									$staff_id = $getapptdata['staff_id'];
									$service_id = $getapptdata['service_id'];
									
									$createdbystaff_id = $getapptdata['createdby'];
									$dateadded_appt = $getapptdata['dateadded'];
									
									$updatedbystaff_id = $getapptdata['updatedby'];
									$datemodified_appt = $getapptdata['datemodified'];
									
									$getcustomerdata = getAnyTableWhereData($customer_info_table," and customer_id='$customer_id'");
									$getstaffdata = getAnyTableWhereData($staff_table," and staff_id='$staff_id'");
									
									$getservicedata = getAnyTableWhereData($services_table," and service_id='$service_id'");
									
									$getstaffcreatedbydata = getAnyTableWhereData($staff_table," and staff_id='$createdbystaff_id'");
									
									$getstaffupdatedbydata = getAnyTableWhereData($staff_table," and staff_id='$updatedbystaff_id'");
								  ?>
                          <tr>
                            <td >&nbsp;</td>
                          </tr>
                          <?php
								  }
								  ?>
                          <tr>
                            <td>&nbsp;</td>
                          </tr>
                          <tr>
                            <td><table cellpadding="0" cellspacing="2" border="0" style="background-color:#CCCCCC">
                                <tr>
                                  <td  bgcolor="white" height="3" nowrap><img src="images/spacer.gif" height="3" width="13"></td>
                                  <td class="body_text6" height="3" nowrap>&nbsp;Open&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                                  <td bgcolor="#999999" height="3"><img src="images/spacer.gif" height="3" width="13"></td>
                                  <td class="body_text6" height="3" nowrap>&nbsp;Reserved&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                                  <td bgcolor="#666666" height="3"><img src="images/spacer.gif" height="3" width="13"></td>
                                  <td class="body_text6" height="3" nowrap>&nbsp;Unavailable</td>
                                  <?php
								 $getapptstatus_sql = "select * from appointment_status_type where business_id='$business_id'";
								  $getapptstatus_query = mysql_query($getapptstatus_sql);
								  while($getapptstatus_data = mysql_fetch_array($getapptstatus_query))
								  {
								       $description = $getapptstatus_data['description'];
									   $color = $getapptstatus_data['color'];
								      
								      ?>
                                  <td bgcolor="<?=$color;?>" height="3" nowrap><img src="images/spacer.gif" height="3" width="13"></td>
                                  <td class="body_text6" height="3" nowrap>&nbsp;
                                    <?=$description;?>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                                  <?php
								  }
								  ?>
                                </tr>
                              </table></td>
                          </tr>
                          <tr>
                            <td>&nbsp;</td>
                          </tr>
                        </table>
                        <script type="text/javascript">
screen_width=screen.width - 285;
screen_height=screen.height - 410;
document.write('<div style=" width:'+screen_width+'px; height:'+screen_height+'px; overflow:auto;">');
</script>
                        </div>                      </td>
                    </tr>
                  </table>
                  
                  <table cellpadding="0" cellspacing="0" border="0">
                    <tr>
                      <td><img src="images/1_q4.gif" border="0" alt="" width="10" height="10"></td>
                      <td style="width:100%; background-image:url(images/1_li1.gif)"></td>
                      <td><img src="images/1_q3.gif" border="0" alt="" width="10" height="10"></td>
                    </tr>
                  </table></td>
                
                <td class="col_right">
                  <table border="0"cellspacing="0" cellpadding="0" class="box_width_right">
                    <tr>
                      <td></td>
                      <td width="100%"><table border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td></td>
                          </tr>
                        </table></td>
                    </tr>
                  </table>
                  
                </td>
              </tr>
            </table>
            
            
          </td>
        </tr>
        <tr>
          <td><table cellpadding="0" cellspacing="0" border="0" style="height:98px; background-image:url(images/bot.gif)">
              <tr>
                <td><table cellpadding="0" cellspacing="0" border="0" class="footer">
                    <tr>
                      <td height="77"><img src="images/spacer.gif" border="0" alt="" width="25" height="1"></td>
                      <td style="width:207px"><br style="line-height:49px">
                        <img src="images/p1.gif" border="0" alt="" width="145" height="24"><br></td>
                      <td style="width:532px">&nbsp;</td>
                    </tr>
                  </table></td>
              </tr>
            </table></td>
        </tr>
      </table></td>
  </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center"></td>
  </tr>
</table>

</body>

</html>
